import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import Cookies from 'js-cookie'
import ElementPlus from 'element-plus'
import '@/assets/styles/index.scss' // global css
import 'element-plus/dist/index.css';
// import store from './store/token.js';
import Breadcrumb from './components/Breadcrumb/index.vue';
import zhCn from 'element-plus/es/locale/lang/zh-cn'; // 引入中文语言包
// import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// svg图标
import SvgIcon from '@/components/SvgIcon'
import elementIcons from '@/components/SvgIcon/svgicon'
// import {createPersistedState} from 'pinia-persistedstate-plugin';
import { createPersistedState } from 'pinia-plugin-persistedstate';


const app = createApp(App)
const persist = createPersistedState()

// for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
//   app.component(key, component)
// }

app.use(router)
// app.use(store)
app.use(elementIcons)
app.use(createPinia().use(persist))
app.component('svg-icon', SvgIcon)
app.component('Breadcrumb', Breadcrumb)

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: zhCn, // 设置全局语言为中文
  // locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
})

app.mount('#app')